package com.zhongjinkang.rhythm.network

import okhttp3.OkHttpClient
import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory
import java.util.concurrent.TimeUnit

class RequestBuilder {

   private var retrofitBuilder:Retrofit

   init {
       OkHttpClient.Builder().connectTimeout(10,TimeUnit.SECONDS).build().apply {
          retrofitBuilder=Retrofit.Builder().baseUrl(BASE_URL).addConverterFactory(GsonConverterFactory.create())
              .client(this).build()
      }

   }

    fun <T> getApi(apiType:Class<T>):T{
        return retrofitBuilder.create(apiType)
    }



    companion object{
         const val BASE_URL="http://192.168.1.122:8080"


    }
}